package br.com.k19.jpa;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;

public class EditoraRepository {
	private EntityManager manager;
	
	public EditoraRepository(EntityManager e){
		this.manager = e;
	}
	public void setAdiciona(Editora e){
		this.manager.persist(e);
	}
	public Editora getBusca(long id){
		return this.manager.find(Editora.class, id);
	}
	public List<Editora> getListaDeEditoras(){
		Query x = this.manager.createQuery("SELECT e FROM Editora e");
		return x.getResultList();
	}
	
}
